﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThermalEquipmentDesign.Model;
using System.Windows.Input;
using System.Windows;
using ThermalEquipmentDesign.Model.Condenser.VerticalPipeR717;
using ThermalEquipmentDesign.Reference_Path;
using ThermalEquipmentDesign.Reference_Path.Condenser;

namespace ThermalEquipmentDesign.ViewModel.Condenser
{
    public class VerticalPipeR717ViewModel : ObservableObject
    {
        // Declare fields for binding
        #region fields for binding
        private VerticalPipeR717 overticalPipeR717 = new VerticalPipeR717();
        private VerticalPipeR717Result overticalPipeR717Result = new VerticalPipeR717Result();
        private ICommand calculateVerticalPipeR717;
        private String stooltip = "Press F1 for Help";
        #endregion

        // Create properties for binding
        #region properties for binding
        public String sTooltip
        {
            get { return stooltip; }
            set { stooltip = value; }
        }

        public VerticalPipeR717 oVerticalPipeR717
        {
            get { return overticalPipeR717; }
            set
            {
                if (value != overticalPipeR717)
                {
                    overticalPipeR717 = value;
                    OnPropertyChanged("oVerticalPipeR717");                    
                }
            }
        }

        public VerticalPipeR717Result oVerticalPipeR717Result
        {
            get { return overticalPipeR717Result; }
            set {
                if (value != overticalPipeR717Result)
                {
                    overticalPipeR717Result = value;
                    OnPropertyChanged("oVerticalPipeR717Result");
                }          
            }
        }

        public ICommand CalculateVerticalPipeR717
        {
            get
            {
                if (calculateVerticalPipeR717 == null)
                {
                    calculateVerticalPipeR717 = new RelayCommand(
                        param => ImplementCalculationVerticalPipeR717()
                    );
                }
                return calculateVerticalPipeR717;
            }
        }
        #endregion

        /// <summary>
        /// Calculate design parameter for Vertical Condenser
        /// </summary>
        public void ImplementCalculationVerticalPipeR717()
        {            
            VerticalPipeR717Model oVerticalPipeR717Model = new VerticalPipeR717Model();
            overticalPipeR717Result = oVerticalPipeR717Model.ImplementCalculation(overticalPipeR717);
        }
        //  Load Reference for the helping
        public void LoadReference(string sIndex)
        {
            System.Windows.Forms.Help.ShowHelp(null, ReferencePath.ReferenceFile, System.Windows.Forms.HelpNavigator.KeywordIndex, VerticalPipeR717Reference.ResourceManager.GetString(sIndex));
        }
    }
}
    

